package com.xqboss.web.controller.consumer;

import com.xqboss.apps.dto.consumer.WebConsumerRealNameDto;
import com.xqboss.apps.service.consumer.ConsumerRealNameService;
import com.xqboss.apps.vo.consumer.WebConsumerRealNameVo;
import com.xqboss.common.annotation.Log;
import com.xqboss.common.core.controller.BaseController;
import com.xqboss.common.core.domain.AjaxResult;
import com.xqboss.common.core.domain.R;
import com.xqboss.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户实名认证Controller
 *
 * @author xqboss
 * @date 2023-08-08
 */
@Api(tags = {"实名认证管理"})
@RestController
@RequestMapping("/web/consumer/real-name")
public class WebConsumerRealNameController extends BaseController {
    @Autowired
    private ConsumerRealNameService consumerRealNameService;

    @PreAuthorize("@ss.hasPermi('web:consumer:real-name:list')")
    @ApiOperation("用户实名认证列表")
    @GetMapping("/list")
    public R list(WebConsumerRealNameDto dto) {
        dto.startPageAndOrder();
        List<WebConsumerRealNameVo> list = consumerRealNameService.selectConsumerRealNameList(dto);
        return R.ok(list);
    }

//    /**
//     * 导出用户实名认证列表
//     */
//    @Log(title = "用户实名认证", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, ConsumerRealName consumerRealName) {
//        List<ConsumerRealName> list = consumerRealNameService.selectConsumerRealNameList(consumerRealName);
//        ExcelUtil<ConsumerRealName> util = new ExcelUtil<ConsumerRealName>(ConsumerRealName.class);
//        util.exportExcel(response, list, "用户实名认证数据");
//    }


    /**
     * 删除用户实名认证
     */
    @PreAuthorize("@ss.hasPermi('web:consumer:real-name:del')")
    @Log(title = "用户实名认证", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(consumerRealNameService.deleteConsumerRealNameByIds(ids));
    }
}

